<?php
	include '../include/functions.php';
	//Connect To Database
	dbConnect();
?>
<html>
  <HEAD>
    <TITLE>JoshHughes.com NFL Football Pool Site</TITLE>
    <link rel="stylesheet" href="css/NFLPool.css" type="text/css">
</head>
<body leftmargin="0" topmargin="0" bottommargin="0" rightmargin="0" marginwidth="0" marginheight="0">
<?
	$SQL = "SELECT ID, username, email FROM NFLUsers WHERE flag=1";
	//Open Record Set using SQL Query
	$Emailresult = mysql_query($SQL) or die("Cannot query the database.<br>" . mysql_error());
	//set up some email varibables
	$adminmail = "<Football@joshhughes.com>";
	$MailFrom = "From: Football@joshhughes.com";
	$MailSubject = "Football Pool Regular Season Results";
	$MailBody = "Congratulations to this year's regular season winners!!\n
Best Straight Score - Ellen [173]
Best Percentage - steelers [172 out of 254 picks for 67.72%]
Best Weighted Score - SteelersFan [1324]
Survivor - TWO users survived from our first week (9) through the end of the season, way to go Amelia & joe!\n
See all the regular season results at http://football.joshhughes.com/standings.php.\n\n - Josh\nFootball Pool Administrator";
	do{
		if ($Emailrow["email"] != "") {   //add user's email to the list.
		$adminmail .= ", ".$Emailrow["username"]." <".$Emailrow["email"].">";
		}//end if ($Emailrow["email"] != "")
	}while($Emailrow = mysql_fetch_array($Emailresult));
	
	$MailTo = $adminmail;
	//mail($MailTo, $MailSubject, $MailBody, $MailFrom);  //message send
	echo "<H1>MailTo: $MailTo</H1>";
	
	
?>
</body>
</html>